<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>百度</title>
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
    <style>
        body {
            max-width: 800px;
            margin: 0 auto;
        }

        #box {
            width: 100%;
        }
        .div-fixed2{
            position: fixed;
            right: 5px;
            top:40%;
            z-index: 999;
            text-align: center;
        }
        .div-fixed2 button{
            width: 76px;
            font-size: 14px;
            height: 45px;
        }
        .form{
            padding: 30px 8px 8px 8px;
            font-size: 20px;
        }
        .form-div{
            display: flex;
            margin-bottom: 16px;
        }
        .form-div .l{
            width: 130px;
        }
        .form-div .r{
            width: calc(100% - 150px);
        }
        .form-div .r textarea{
            width:100%;
            font-size: 16px;
            box-sizing: border-box;
        }
        #token1{
            height: 24px;
        }
        #token2{
            height: 96px;
        }
        #token3{
            height: 150px;
        }
        #saveBtn{
            width:100%;
            height: 60px;
            font-size: 24px;
        }
        button {
            margin-bottom: 5px;
        }
    </style>
</head>

<body>
    <div id="box">
        <div class="div-fixed2">
            <button type="button" onclick="window.location.reload()">刷新</button><br />
            <button type="button" onclick="window.location.href = './shabi1.html'">家园</button><br />
            <button type="button" onclick="window.location.href = './shabi2.html'">斗兽</button><br />
            <button type="button" onclick="window.location.href = './shabi3.html'">每日</button><br />
            <button type="button" onclick="window.location.href = './shabi4.html'">换号</button><br />
        </div>
        <div class="form">
            <!--<div class="form-div">-->
            <!--    <div class="l">-->
            <!--        主号（0）-->
            <!--    </div>-->
            <!--    <div class="r">-->
            <!--        <textarea id="token1" placeholder="请输入token"></textarea>-->
            <!--    </div>-->
            <!--</div>-->
            <!--<div class="form-div">-->
            <!--    <div class="l">-->
            <!--        斗兽（1-11）-->
            <!--    </div>-->
            <!--    <div class="r">-->
            <!--        <textarea id="token2" placeholder="请输入token"></textarea>-->
            <!--    </div>-->
            <!--</div>-->
            <div class="form-div">
                <div class="l">
                    全部token
                </div>
                <div class="r">
                    <textarea id="token3" placeholder="请输入token"></textarea>
                </div>
            </div>
            <div class="form-div">
                <div class="l">
                    
                </div>
                <div class="r">
                    <button id="saveBtn" type="button" onclick="saveToken()">保  存</button>
                </div>
            </div>
        </div>
        <br />
        [<span id="setInterval"></span>]
    </div>
    <script src="./jquery.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="./shabi.js?v4.1.2"></script>
    <script>
        function saveToken(){
            // var token1 = document.getElementById("token1").value;
            // var token2 = document.getElementById("token2").value;
            var token3 = document.getElementById("token3").value;
            // if(token1!=""){
            //     token1 = token1.slice(token1.indexOf('31046.')+6);
            //     token1 = '31046.'+token1;
            //     localStorage.setItem("texun_token",token1);
            // }
            // if(token2){
            //     var token_list = [];
            //     var token_list_arr = token2.split(",")
            //     for(var i=0;i<token_list_arr.length;i++){
            //         var item_token = token_list_arr[i];
            //         token_list.push(item_token.slice(item_token.indexOf('sid=')+4))
            //     }
            //     localStorage.setItem("texun_token_list",JSON.stringify(token_list));
            // }
            if(token3){
                var token1 = '';
                var token2 = [];
                var token_list_all = [];
                var token_list_all_arr = token3.split(",");
                
                token1 = token_list_all_arr[0]
                token1 = token1.slice(token1.indexOf('31046.')+6);
                token1 = '31046.'+token1;
                localStorage.setItem("texun_token",token1);
                
                var token_list = [];
                var token_list_arr = token_list_all_arr.slice(1,12)
                for(var i=0;i<token_list_arr.length;i++){
                    var item_token = token_list_arr[i];
                    token_list.push(item_token.slice(item_token.indexOf('sid=')+4))
                }
                localStorage.setItem("texun_token_list",JSON.stringify(token_list));
                
                for(var i=0;i<token_list_all_arr.length;i++){
                    var item_token = token_list_all_arr[i];
                    token_list_all.push(item_token.slice(item_token.indexOf('sid=')+4))
                }
                localStorage.setItem("texun_token_list_all",JSON.stringify(token_list_all));
            }
            if(token1 || token2 || token3){
                alert("保存成功")
            }
        }
        function mastUseTexunLoginPageConsole(){
            let idPassList = [
                { name: "31046", pass: "dg110929" },
                { name: "31077", pass: "dg110929" },
                { name: "31246", pass: "dg110929" },
                { name: "31055", pass: "dg110929" },
                { name: "31061", pass: "dg110929" },
                { name: "31078", pass: "dg110929" },
                { name: "31158", pass: "dg110929" },
                { name: "31159", pass: "dg110929" },
                { name: "31161", pass: "dg110929" },
                { name: "31187", pass: "dg110929" },
                { name: "31188", pass: "dg110929" },
                { name: "31200", pass: "dg110929" },
                { name: "31718", pass: "dg110929" },
                { name: "31741", pass: "dg110929" },
                { name: "31803", pass: "dg110929" },
                { name: "31806", pass: "dg110929" },
                { name: "31822", pass: "dg110929" },
                { name: "31828", pass: "dg110929" },
                { name: "31835", pass: "dg110929" },
                { name: "31845", pass: "dg110929" },
                { name: "31858", pass: "dg110929" },
                { name: "31857", pass: "dg110929" },
                { name: "31855", pass: "dg110929" },
                { name: "31854", pass: "dg110929" },
                { name: "31852", pass: "dg110929" },
                { name: "31309", pass: "dg110929" },
                { name: "30876", pass: "ping141" },
                { name: "31764", pass: "dg110929" },
                { name: "31841", pass: "dg110929" },
                { name: "31842", pass: "dg110929" },
                { name: "31670", pass: "aa5211314.." },
                { name: "75473", pass: "dg110929" },
                { name: "75553", pass: "dg110929" },
                { name: "75631", pass: "dg110929" },
                { name: "75632", pass: "dg110929" },
                { name: "75636", pass: "dg110929" },
                { name: "75646", pass: "dg110929" },
                { name: "75647", pass: "dg110929" },
                { name: "75677", pass: "dg110929" },
                { name: "75678", pass: "dg110929" },
                { name: "75683", pass: "dg110929" },
            ]
            let index_ajax = 0;
            let timerajax = setInterval(function () {
                if (index_ajax >= idPassList.length) {
                    clearInterval(timerajax);
                    let coklist = document.cookie.split(";").filter(i => i.includes("sid"));
                    let tokenList = [];
                    coklist.forEach(item => {
                        let tokenAfter = "http://129.28.24.210/home/my_home.aspx?sid=" + item.split("sid_")[1].replace(/=/, ".");
                        tokenList.push(tokenAfter);
                    })
                    localStorage.setItem("ajaxGetTexunTokenUsed", tokenList.join(","));
                    console.log(tokenList.join(","));
                }else{
                    $.ajax({
                        url: `http://129.28.24.210/server/login.aspx?name=${idPassList[index_ajax].name}&pass=${idPassList[index_ajax].pass}`,
                        type: 'GET',
                        success: function(data, textStatus, request) {
                            console.log(document.cookie);
                        },
                        error: function(xhr, textStatus, errorThrown) {
                            console.log('Error fetching data');
                        }
                    });
                    index_ajax++;
                }
            }, 1500);
        }
    </script>
</body>

</html>